'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var itemMasterModel = baseController.getBaseDocFields();
itemMasterModel.Code = {
    type: String,
    default: '',
    trim: true,
    unique: '编码已存在'
};

itemMasterModel.Name = {
    type: String,
    default: '',
    trim: true
};
//规格
itemMasterModel.Specification = {
    type: String,
    default: '',
    trim: true
};
//料品分类
itemMasterModel.ItemCategory = {
    type: Number
};
itemMasterModel.IsEffective = {
    type: Boolean
};

var itemMasterSchema = new Schema(itemMasterModel);
itemMasterSchema.index({Name: 1});
itemMasterSchema.index({Code: 1}, {"unique": true});

mongoose.model('ItemMaster', itemMasterSchema, 'ItemMaster');
